import { Catch, MidwayHttpError } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
// step1 :声明一种异常
export class BillStateError extends MidwayHttpError {
  constructor(message: string) {
    super(message, 700);
  }
}
// step2 :捕获该异常
@Catch(BillStateError)
export class BillStateErrorFilter {
  async catch(err: BillStateError, ctx: Context) {
    ctx.status = err.status;
    return err.message;
  }
}
// step3 ：启用
